package com.wb.core08_常用类.日期.练习;

import java.util.Random;

/**
 * @author 黄衡熙
 * @version 1.0
 */
// 随机生成一个字符串,字符串由四个字符组成,每一个字符由英文字母数字组成
public class Test1 {
    public static void main(String[] args) {
        char[] arr = new char[62];
        for (int i = 0; i < 26; i++) {
            arr[i] = (char) (65 + i);
        }
        for (int i = 0; i < 26; i++) {
            arr[26 + i] = (char) (97 + i);
        }
        for (int i = 0; i < 10; i++) {
            arr[52 + i] = (char) (48 + i);
        }
        Random r = new Random();
        String str = "";
        for (int j = 0; j < 4; j++) {
            int randomNum = r.nextInt(arr.length);
            str += arr[randomNum];
        }
        System.out.println(str);

    }
}
